Skip to content

th pearls: skip git auto-commit from linked worktrees#94

Merged
brentrager merged 1 commit into
mainfrom
fix-pearl-autocommit-worktree-guard
Jun 13, 2026
Merged

th pearls: skip git auto-commit from linked worktrees#94
brentrager merged 1 commit into
mainfrom
fix-pearl-autocommit-worktree-guard

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

auto_commit_pearl_state git-commits the .smooth/dolt/ pearls store on whatever branch the caller is on. Dolt rewrites its mutable pointer files (journal.idx, manifest, the journal chunk) on every store open, and each linked worktree (git worktree add) checks out its own copy. Committing those binary pointers onto a feature branch produces divergence that can't be merged back to main — the recurring .smooth/dolt conflicts hit repeatedly during the smooai SMOODEV-1818 Lambda→Rust migration (one caused a transient pearl-close data-loss).

Solution

Detect a linked worktree (git rev-parse --git-dir--git-common-dir) and skip the git auto-commit there, logging a hint to run pearl mutations from the primary worktree. The dolt mutation and th pearls push (refs/dolt/data) still capture the change — pearl state simply stays on one lineage instead of forking per branch. Primary-worktree behaviour is unchanged.

This is the every-repo half of the fix; the smooai side excludes .smooth/dolt from its pre-commit git add -A (SmooAI/smooai#1513).

Verification

  • New is_linked_worktree + worktree_guard_tests: primary worktree → not linked, git worktree add tree → linked, non-git dir → false. cargo test -p smooai-smooth-cli worktree_guard → 2 passed.
  • cargo fmt --check clean; cargo clippy clean (no new warnings).

Tracking: SMOODEV-1836

🤖 Generated with Claude Code

auto_commit_pearl_state committed the .smooth/dolt store to git on whatever
branch the caller was on. Dolt rewrites mutable pointer files (journal.idx,
manifest, journal chunk) on every open, and each linked worktree has its own
checked-out copy — committing those onto feature branches produced binary
pointer divergence that can't be merged back to main (recurring conflicts
during the smooai SMOODEV-1818 migration).

Detect a linked worktree via git-dir != git-common-dir and skip the git
commit there (the dolt mutation + th pearls push to refs/dolt/data still
capture the change). Primary-worktree behaviour unchanged. Adds
is_linked_worktree + tests covering primary vs linked vs non-git dirs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d545073

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager brentrager enabled auto-merge (squash) June 13, 2026 05:03
@brentrager brentrager merged commit ab5a455 into main Jun 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant